﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

using HotelManagement.Connector;

namespace HotelManagement.DAO
{
    class StaffDAO
    {
        
        public StaffDAO()
        {
        }

        public int Signin(string id, string password)
        {
            DA_QLKSDataSetTableAdapters.NHANVIEN_TIM_TENDANGNHAPTableAdapter adapter = 
                new DA_QLKSDataSetTableAdapters.NHANVIEN_TIM_TENDANGNHAPTableAdapter();

            DA_QLKSDataSet.NHANVIEN_TIM_TENDANGNHAPDataTable table =
                new DA_QLKSDataSet.NHANVIEN_TIM_TENDANGNHAPDataTable();

            table = adapter.GetData(id, password);

            if (table.Count() == 0)
                return 0;

            return (new DA_QLKSDataSetTableAdapters.NHANVIEN_TIM_PHANQUYENTableAdapter())
                .GetData(table[0].TenDangNhap)[0].Quyen;
        }
    }
}
